package com.mask.im.server.netty.enums;

import lombok.Getter;

/**
 * @author jian
 */

@Getter
public enum IMActionEnum {
    //正在输入中状态
    TYPING(10009, "TYPING"),
    //新用户注册到channel中
    REGISTER(10010, "register"),
    //心跳连接管理
    HEART_BEAT(10000, "HEART_BEAT"),
    //上下线通知
    FRIEND_STATUS(10002, "FRIEND_STATUS"),
    //聊天消息
    FRIEND_CHAT(10003, "FRIEND_CHAT"),
    //好友请求
    FRIEND_ACTION(10004, "FRIEND_ACTION"),
    //对消息操作
    MESSAGE_ACTION(10005, "MESSAGE_ACTION"),
    //群聊
    GROUP_CHAT(10006, "GROUP_CHAT"),
    //视频通话
    VIDEO_CALLS(10007, "VIDEO_CALLS"),
    //语音通话
    VOICE_CALLS(10008, "VOICE_CALLS"),

    ADD_FRIEND1(100041, "ADD_FRIEND1");


    private final Integer action;
    private final String execute;

    IMActionEnum(Integer action, String execute) {
        this.action = action;
        this.execute = execute;
    }

    public static IMActionEnum getByType(Integer type) {
        if (type == null) {
            return null;
        }
        for (IMActionEnum value : values()) {
            if (value.getAction().equals(type)) {
                return value;
            }
        }
        return null;
    }
}
